package com.example.user1.controller;


import com.example.user1.cmd.LoginCmd;
import com.example.user1.cmd.RegistryUserEmailCmd;
import com.example.user1.cmd.RegistryUserPasswordCmd;
import com.example.user1.cmd.RegistryUserPhoneCmd;
import com.example.user1.service.UserService;
import com.example.user1.vo.Result;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequiredArgsConstructor
@RequestMapping("/registry")
public class RegistryController {
    private final UserService userService;
    @PostMapping("/phone")
    public Result<String> phone(@RequestBody @Valid RegistryUserPhoneCmd cmd){
        userService.registry(cmd);
        return Result.success();
    }
    @PostMapping("/email")
    public Result<String> email(@RequestBody @Valid RegistryUserEmailCmd cmd){
        userService.registry(cmd);
        return Result.success();
    }

    @PostMapping("/account")
    public Result<String> account(@Valid RegistryUserPasswordCmd cmd){
        userService.registry(cmd);
        return Result.success();
    }
}
